$package('itsm.system');

itsm.system.activationCodeMain=function(){
	this.opt='';
	return {
		//列表
		activationCodeMainGrid:function(){
			var params = $.extend({},jqGridParams, {
				url:'activationCode!findEmailAuthPager.action',
				caption:'邮件验证码',
				colNames:['ID','邮件地址','激活码','验证源','验证方式','状态(YES,已使用)','有效期'],
			 	colModel:[
			 	          {name:'id',align:'center'},
			 	          {name:'authStr',align:'left'},
			 	         {name:'activationCode',align:'left'},
			 	          {name:'category',align:'left'},
			 	          {name:'type',align:'left'},
			 	          {name:'status',align:'center'},
			 	          {name:'validDate',align:'left'}
			 	          
			 	],
				jsonReader: $.extend(jqGridJsonReader, {id: "id"}),
				sortname:'id',
				pager:'#emailAuthMainPager'
				});
				$("#emailAuthMainGrid").jqGrid(params);
				$("#emailAuthMainGrid").navGrid('#emailAuthMainPager',navGridParams);
				//列表操作项
				$("#t_emailAuthMainGrid").css(jqGridTopStyles);
				$("#t_emailAuthMainGrid").html($('#emailAuthMainGridToolbar').html());
				
				//自适应宽度
				setGridWidth("#emailAuthMainGrid","regCenter",10);
			
		},
		
		//删除
		deleteActionCodes:function(){
			checkBeforeDeleteGrid('#emailAuthMainGrid',function(rowIds){
				var pp = $.param({'ids':rowIds},true);
				$.post("activationCode!deleteActionCodes.action", pp, function(){
					$('#emailAuthMainGrid').trigger('reloadGrid');
					msgShow('删除成功!','show');
				}, "json");
			});
		},
		
		init:function(){
			itsm.system.activationCodeMain.activationCodeMainGrid();
		}
	}
	
}();

$(function(){
	itsm.system.activationCodeMain.init();
});